package com.suixinsanren.design.iterator.demo01;

import java.util.ArrayList;

public class PancakeHouseMenu {

    private final ArrayList<MenuItem> menuItems;

    public PancakeHouseMenu() {
        menuItems = new ArrayList<>();
        addItem("K&B的煎饼早餐", "煎饼配炒蛋和烤面包", true, 2.99);
        addItem("普通煎饼早餐", "煎饼配煎蛋、香肠", false, 2.99);
        addItem("蓝莓煎饼", "用新鲜蓝莓做的煎饼", true, 3.49);
        addItem("华夫饼", "华夫饼，蓝莓或草莓任你选择", true, 3.59);
    }

    public void addItem(String name, String description, boolean vegetarian, double price) {
        menuItems.add(new MenuItem(name, description, vegetarian, price));
    }

    public ArrayList<MenuItem> getMenuItems() {
        return menuItems;
    }

    public Iterator<MenuItem> iterator() {
        return new PancakeHouseMenuIterator(this.menuItems);
    }
}
